<?php
use yii\helpers\Html;
use kartik\form\ActiveForm;
use kartik\file\FileInput;
use common\widgets\cover_upload\CoverUpload;
use yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $model admin\modules\system\models\forms\Banners */
/* @var $form \kartik\form\ActiveForm */

?>

<div class="banners-form">

    <?php $form = ActiveForm::begin(); ?>
    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
    <?= $form->field($model, 'url')->widget(CoverUpload::className(), [
        'defaultCoverUrl' => Yii::$app->urlManagerXcxApi->createAbsoluteUrl(['/guest/pub/gd', 'w' => 600, 'h' => 300]),
//        'coverWidth' => 100,
        'uploadUrl' => Yii::$app->urlManager->createAbsoluteUrl(['/pub/ajax/upload-cover']),
        'options' => [
            'class' => 'form-control url-cover'
        ],
    ])?>
    <?= $form->field($model, 'status')->dropDownList($model::getStatusDesc()) ?>
    <?= $form->field($model, 'banner_sort')->textInput() ?>
	<?php if (!Yii::$app->request->isAjax){ ?>
	  	<div class="form-group">
	        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', '新建') : Yii::t('app', '更新'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
	    </div>
	<?php } ?>

    <?php ActiveForm::end(); ?>

</div>
